import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class parse {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String a[] = cin.next().split("/");
        String t[] = new String[3];
        t[0] = ((Integer.valueOf(a[0]) >= 60) ? "19" + a[0] : "20" + a[0]) + "-" + a[1] + "-" + a[2];
        t[1] = ((Integer.valueOf(a[2]) >= 60) ? "19" + a[2] : "20" + a[2]) + "-" + a[0] + "-" + a[1];
        t[2] = ((Integer.valueOf(a[2]) >= 60) ? "19" + a[2] : "20" + a[2]) + "-" + a[1] + "-" + a[0];
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        sf.setLenient(false);
        Set<String> s = new TreeSet<String>();
        for (String T : t) {
            try {
                sf.parse(T);
            } catch (ParseException e) {
                continue;
            }
            s.add(T);
        }
        for(String T:s)
            System.out.println(T);
    }
}
